﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Liang.UI
{
    public partial class FrmSelectFilePath : Form
    {
        public string filePaht = "";
        private string fileType { get; set; }

        public FrmSelectFilePath()
        {
            InitializeComponent();
        }

        public FrmSelectFilePath(string fileType)
        {
            this.fileType = fileType;
            InitializeComponent();
        }

        private void FrmSelectFilePath_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (fileType.Equals("1"))
            {
                //选择文件夹
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.Description = "请选择文件路径";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string foldPath = dialog.SelectedPath;
                    textBox_qypath.Text = foldPath;
                    filePaht = foldPath;
                }
            }
            else
            {
                //选择文件
                OpenFileDialog fileDialog = new OpenFileDialog();
                fileDialog.Multiselect = true;
                fileDialog.Title = "请选择文件";
                fileDialog.Filter = "所有文件(*.*)|*.*";
                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    textBox_qypath.Text = fileDialog.FileName;
                    filePaht = fileDialog.FileName;
                }
            }        
        }

        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
